VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsSendEMail"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Public Function SendMail(ByVal Recipient As String, ByVal Address As String, ByVal strSubject As String, ByVal strBody As String, ByVal strAttachmentPath As String, ByVal strAttachmentName As String) As String

  On Error GoTo ERR_FIX
  
  Form1.MAPISession.DownLoadMail = False
  Form1.MAPISession.NewSession = False
  Form1.MAPISession.LogonUI = False
  
  Form1.MAPISession.SignOn
  
  Form1.MAPIMessages.SessionID = Form1.MAPISession.SessionID
  Form1.MAPIMessages.Compose
  Form1.MAPIMessages.RecipDisplayName = Recipient
  Form1.MAPIMessages.RecipAddress = Address
  Form1.MAPIMessages.MsgSubject = strSubject
  Form1.MAPIMessages.MsgNoteText = strBody
  If strAttachmentPath <> "" Then Form1.MAPIMessages.AttachmentPathName = strAttachmentPath
  
  Form1.MAPIMessages.Send False
  
  Form1.MAPISession.SignOff
  
  SendMail = ""
  Exit Function
      
ERR_FIX:
   SendMail = Err.Number & " - " & Err.Description
   Form1.MAPISession.SignOff
End Function

